<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: 29125
  Date: 2022/5/27
  Time: 12:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>列表</title>
</head>
<body>
<table border="1" width="90%" style="margin: 0 auto;">
    <tr>
        <%--           表头单元格 - 包含头部信息（由 <th> 元素创建） --%>
        <th>编号</th>
        <th>姓名</th>
        <th>生日</th>
        <th>性别</th>
        <th>职业</th>
        <th>住所</th>
        <th>电话</th>
        <th>操作</th>
    </tr>
    <%--      数据遍历输出  --%>
    <c:forEach items="${pageBean.data}" var="profile">
        <tr>
                <%--                标准单元格 - 包含数据（由 <td> 元素创建）--%>
            <td>${profile.id}</td>
            <td>${profile.name}</td>
                <%--                          data 规定时间格式--%>
            <td>
                    <%--                    <fmt:formatDate value="${book.publicDate}" pattern="yyyy-MM-dd"></fmt:formatDate>--%>
                <fmt:formatDate value="${profile.birthday}" pattern="yyyy-MM-dd"></fmt:formatDate>
            </td>
            <td>${profile.gender}</td>
            <td>${profile.career}</td>
            <td>${profile.address}</td>
            <td>${profile.mobile}</td>
                <%--                 图片回写加载图片             图片路径         设置图片的宽和高--%>
            <td><img src="profilecovers?picture=${profile.picture}" width="50" height="50"></td>
            <td>${book.cid}</td>
                <%--    设置更新删除  创建UpdateUiServlet(updateui)--%>
            <td>
                    <%--                                  创建DeleteBookServlet(deletebook)  --%>
                <c:url var="deleteurl" value="/detail">
                    <c:param name="id" value="${book.id}"></c:param>
                </c:url>
                <c:url var="updateurl" value="/updateui">
                    <c:param name="id" value="${book.id}"></c:param>
                </c:url>
                    <%--                    创建更新跳转标签--%>
                <a href="${updateurl}">修改</a>
            </td>

        </tr>
    </c:forEach>
</table>
<%--进行分页操作时，根据多条件查询，添加&title=${title}&author=${author}--%>
<div style="width: 90%; margin: 0 auto;">
    <a href="booklistpage?pageNum=1&pageSize=${pageBean.pageSize}&title=${title}&author=${author}">首页</a>
    <a href="booklistpage?pageNum=${pageBean.pageNum-1}&pageSize=${pageBean.pageSize}&title=${title}&author=${author}">上一页</a>
    <c:forEach begin="${pageBean.startPage}" end="${pageBean.endPage}" var="num">
        <%--            如果在首页不能点击上一页，如果在尾页不能点击下一页--%>
                    <c:if test="${pageBean.pageNum==num}">
                        <a class="active" href="listpage?pageNum=${num}&pageSize=${pageBean.pageSize}&title=${title}&author=${author}">${num}</a>
                    </c:if>
                    <c:if test="${pageBean.pageNum!=num}">
                        <a href="listpage?pageNum=${num}&pageSize=${pageBean.pageSize}&title=${title}&author=${author}">${num}</a>
                    </c:if>
    </c:forEach>
    <a href="booklistpage?pageNum=${pageBean.pageNum+1}&pageSize=${pageBean.pageSize}&title=${title}&author=${author}">下一页</a>
    <a href="booklistpage?pageNum=${pageBean.pageCount}&pageSize=${pageBean.pageSize}&title=${title}&author=${author}">末页</a>
    <%--        【共${pageBean.pageNum}/${pageBean.pageCount}页】--%>
</div>

</body>
</html>
